package com.fh.service.StatisticsStrategy.enums;

import com.fh.util.Const;
import com.fh.util.PageData;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @Author LiGuangYi Date: 2017/12/26 11:01
 * @description: 金额计算枚举
 */
public enum CountMoneyEnum {
    /**
     * 不添加已还款金额统计
     */
    OVERDUE_AMOUNT_MONEY {
        @Override
        public Map<String, Object> getCountMoney(PageData pd) {
            BigDecimal overdueAmount = (BigDecimal) (pd.containsKey(MoneyFieldsEnum.OVERDUE_AMOUNT.getValue())
                    == true ? pd.get(MoneyFieldsEnum.OVERDUE_AMOUNT.getValue()) :
                    BigDecimal.valueOf(Const.MONEY_ZERO_ZERO_ZERO_DOUBLE));
            BigDecimal overdueFee = (BigDecimal) (pd.containsKey(MoneyFieldsEnum.OVERDUE_FEE.getValue())
                    == true ? pd.get(MoneyFieldsEnum.OVERDUE_FEE.getValue()) :
                    BigDecimal.valueOf(Const.MONEY_ZERO_ZERO_ZERO_DOUBLE));
            MONEY_MAP.put("zongjine", overdueAmount);
            MONEY_MAP.put("zongfaxi", overdueFee);
            MONEY_MAP.put("zongmsg", MoneyTypeEnum.OVERDUE_AMOUNT_MSG.getMsg());
            MONEY_MAP.put("zongfaxmsg", MoneyTypeEnum.OVERDUE_FEE_MSG.getMsg());
            return MONEY_MAP;
        }
    },
    /**
     * 新增的已还款金额统计
     */
    ALREADY_REPAY_MONEY {
        @Override
        public Map<String, Object> getCountMoney(PageData pd) {
            //已使用罚息减免券
            BigDecimal actualRecoverAmount = (BigDecimal) (pd.containsKey(MoneyFieldsEnum.ACTUAL_RECOVER_AMOUNT.getValue())
                    == true ? (pd.get(MoneyFieldsEnum.ACTUAL_RECOVER_AMOUNT.getValue())) :
                    BigDecimal.valueOf(Const.MONEY_ZERO_ZERO_ZERO_DOUBLE));
            //总罚息
            BigDecimal overdueFee = (BigDecimal) (pd.containsKey(MoneyFieldsEnum.OVERDUE_FEE.getValue())
                    == true ? pd.get(MoneyFieldsEnum.OVERDUE_FEE.getValue()) :
                    BigDecimal.valueOf(Const.MONEY_ZERO_ZERO_ZERO_DOUBLE));
            MONEY_MAP.put("zongjine", actualRecoverAmount);
            MONEY_MAP.put("zongfaxi", overdueFee);
            MONEY_MAP.put("zongmsg", MoneyTypeEnum.ALREADY_REPAY_MSG.getMsg());
            MONEY_MAP.put("zongfaxmsg", MoneyTypeEnum.OVERDUE_FEE_MSG.getMsg());
            return MONEY_MAP;
        }
    };

    private static Map<String, Object> MONEY_MAP = new HashMap<>();

    public abstract Map<String, Object> getCountMoney(PageData pd);
}
